<%@page import="java.util.ArrayList"%>
<%@page import="com.portal4kids.model.Info"%>
<%@page import="java.util.List"%>
<%@page import="com.portal4kids.controller.InfoManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Portal for kids</title>

<link rel="stylesheet" href="ap.css">
	<link rel="stylesheet" href="css/themes/base/jquery.ui.all.css">
	<script src="js/jquery-1.7.2.js"></script>
	<script src="js/ui/jquery.ui.core.js"></script>
	<script src="js/ui/jquery.ui.widget.js"></script>
	<script src="js/ui/jquery.ui.accordion.js"></script>
	<link rel="stylesheet" href="css/demos.css">
	<link rel="stylesheet" href="ap.css">
	<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
	<script src="ckeditor/_samples/sample.js" type="text/javascript"></script>
	<link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />
	
	<script>
	$(function() {
		$( "#accordion" ).accordion({
			collapsible: true
		});
	});
	</script>
</head>
<body>
<% InfoManager man = new InfoManager();
	List<Info> infoList = new ArrayList<Info>();
	infoList = man.getInfoFromDB();
%>
<div id="top">
   
    <img src="images/kreska.png" class="kreska">
    <div class="header_txt">
      <p class="header_txt_1">Panel Administracyjny</p>
      <p class="header_txt_2">portal 4 kids</p>
    </div>
    <div class="session">
      <div class="session2">
        przycisk wyloguj
      </div>
    </div>
    <ul id=menu>
      
    <li><s:a action="addPlace">Dodaj Miejsce </s:a></li>
	<li><s:a action="goToAddPeople">Dodaj Ludzi</s:a></li>
	<li><s:a action="goToAddServices">Dodaj Usługi</s:a></li>
	<li><s:a action="goToAddEventToCalendar">Dodaj zdarzenie do kalenarza</s:a></li>
    <li><s:a action="goToAddTravel">Dodaj Biuro Podróży</s:a></li>  
    <li><s:a action="goToEditInfo">+Informacje+</s:a></li> 
    <li><s:a action="goToAddHoliday">Dodaj Wakacje</s:a></li>
    </ul>
    
    <div id=kategorie>

<div class="demo">

				<div id="accordion">
					<h3><a href="#">Aktualności</a></h3>
					<div>
						<form action="editInfo" method="post">
						<input type="hidden" name="info.type" value="Aktualności">
						<table>
						<% if(!infoList.isEmpty() && infoList.get(0).getType().equals("Aktualności")){ %>
							<input type="hidden" name="info.id_info" value="<%=infoList.get(0).getId_info() %>">
						
							
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2">
										<textarea class="ckeditor" cols="80" id="editor1" name="info.description" rows="10">
											<%= infoList.get(0).getDescription() %>
										</textarea>
									</td>
								</tr>
						<%}else{ %>
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2">
										<textarea class="ckeditor" cols="80" id="editor1" name="info.description" rows="10"></textarea>
									</td>
								</tr>
						<%} %>
								<tr>
									<td colspan="2">&nbsp</td>
								</tr>
								<tr>
									<td colspan="2"><input type="submit" value="Zapisz" /> </td>
								</tr>
							</table>
							
						</form>
					</div>
					<h3><a href="#">O nas</a></h3>
					<div>
						<form action="editInfo" method="post">
						<input type="hidden" name="info.type" value="ONas">
						<table>
						<% if(!infoList.isEmpty() && infoList.size() >= 1 ){ 
							if(infoList.get(1).getType().equals("ONas")){
						%>
							<input type="hidden" name="info.id_info" value="<%=infoList.get(1).getId_info() %>">
						
							
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2">
									<textarea class="ckeditor" cols="80" id="editor2" name="info.description" rows="10">
										<%= infoList.get(1).getDescription() %>
									</textarea>
									</td>
								</tr>
						<%}}else{ %>
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2"><textarea class="ckeditor" cols="80" id="editor2" name="info.description" rows="10"></textarea></td>
								</tr>
						<%} %>
								<tr>
									<td colspan="2">&nbsp</td>
								</tr>
								<tr>
									<td colspan="2"><input type="submit" value="Zapisz" /> </td>
								</tr>
							</table>
							
						</form>
					</div>
					<h3><a href="#">Kontakt</a></h3>
					<div>
						<form action="editInfo" method="post">
						<input type="hidden" name="info.type" value="Kontakt">
						<table>
						<% if(!infoList.isEmpty() && infoList.size() > 2){ 
							if(infoList.get(2).getType().equals("Kontakt")){
						%>
							<input type="hidden" name="info.id_info" value="<%=infoList.get(2).getId_info() %>">
						
							
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2"><textarea class="ckeditor" cols="80" id="editor3" name="info.description" rows="10"><%= infoList.get(2).getDescription() %></textarea></td>
								</tr>
						<%}}else{ %>
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2"><textarea class="ckeditor" cols="80" id="editor3" name="info.description" rows="10"></textarea></td>
								</tr>
						<%} %>
								<tr>
									<td colspan="2">&nbsp</td>
								</tr>
								<tr>
									<td colspan="2"><input type="submit" value="Zapisz" /> </td>
								</tr>
							</table>
							
						</form>
					</div>
					<h3><a href="#">Projekt</a></h3>
					<div>
						<form action="editInfo" method="post">
						<input type="hidden" name="info.type" value="Projekt">
						<table>
						<% if(!infoList.isEmpty() && infoList.size() >3){
								if(infoList.get(3).getType().equals("Projekt")){
							%>
							<input type="hidden" name="info.id_info" value="<%=infoList.get(3).getId_info() %>">
						
							
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2"><textarea class="ckeditor" cols="80" id="editor4" name="info.description" rows="10"><%= infoList.get(3).getDescription() %></textarea></td>
								</tr>
						<%}}else{ %>
								<tr>
									<td colspan="2">Opis</td>
									<td colspan="2"><textarea class="ckeditor" cols="80" id="editor4" name="info.description" rows="10"></textarea></td>
								</tr>
						<%} %>
								<tr>
									<td colspan="2">&nbsp</td>
								</tr>
								<tr>
									<td colspan="2"><input type="submit" value="Zapisz" /> </td>
								</tr>
							</table>
							
						</form>
					</div>
					
					</div>
				</div>
				
				</div><!-- End demo -->


</div>
</body>
</html>